





///Figure 1 - average usage

	
use "stata data/A1 data -8 to 8 HUGE", clear //know just want the 38/42 part

keep if year == 2014
gen dow = dow(date)
keep if inrange(dow,1,5)
drop if date == mdy(7,4,2014) //july 4th
drop if date == mdy(9,1,2014) //Labour day


merge m:1 sa using "stata data/sas_used_in_regressions" //from step 7
keep if _merge == 3

fcollapse (mean) kwh, by(hour)
gegen total_kwh = sum(kwh)
save "stata data/graph avg pre period usage", replace


replace hour = 24 if hour == 0
sort hour 
label variable hour "Hour"

label variable kwh "Average electricity consumption (kWh)"

twoway (line kwh hour , color(black) lwidth(mediumthick)), ///
	graphregion(color(white)) bgcolor(white) ylabel(,grid glcolor(gs15) angle(0))  xlab(2 "2am" 6 "6am" 10 "10am"  14 "2pm" 18 "6pm" 22 "10pm")  xline(14 18, lcolor(black) lpattern(dash) lwidth(mediumthick)) 

graph export "latex/average_A1_usage.pdf", replace 